#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
bool bg;
string s[N];
string t[N];
int dfn[N],dft;
int dep[N];
int siz[N];
int fath[N];
int rnk[N];
vector<int> bian[N];
void dfs(int x,int fa){
    dep[x] = dep[fa] + 1;
    fath[x] = fa;
    siz[x] = 1;
    dfn[x] = ++dft;
    rnk[dfn[x]] = x;
    for(int v : bian[x]){
        dfs(v,x);
        siz[x] += siz[v];
    }
}
bool cmp1(int x,int y){
    return dep[x] < dep[y];
}
int st[18][N];
void pre_lca(){
    for(int i = 1;i <= dft;i++){
        st[0][i] = rnk[i];
    }
    for(int j = 1;(1<<j) <= dft;j++){
        for(int i = 1;i + (1<<j) - 1 <= dft;i++){
            st[j][i] = min(st[j - 1][i],st[j - 1][i + (1<<(j - 1))],cmp1);
        }
    }
}
int lca(int x,int y){
    if(x == y){
        return x;
    }
    int l = min(dfn[x],dfn[y]) + 1,r = max(dfn[x],dfn[y]);
    int s = 31 - __builtin_clz(r - l + 1);
    return fath[min(st[s][l],st[s][r - (1<<s) + 1],cmp1)];
}
bool mark[N];
int c1[N];
struct ACAM{
    int to[N][26];
    int fail[N];
    int cnt[N];
    int rot;
    int pcnt;
    int gen(){
        int now = ++pcnt;
        memset(to[now],0,sizeof(to[now]));
        fail[now] = 0;
        return now;
    }
    void init(){
        rot = gen();
    }
    int insert(string s){
        int now = rot;
        for(char c : s){
            c -= 'a';
            if(!to[now][c]){
                to[now][c] = gen();
            }
            now = to[now][c];
        }  
        cnt[now]++;
        c1[now]++;
        return now;
    }
    void build(){
        queue<int> que;
        for(int i = 0;i < 26;i++){
            if(to[rot][i]){
                que.push(to[rot][i]);
                fail[to[rot][i]] = rot;
            }else{
                to[rot][i] = rot;
            }
        }
        while(que.size()){
            int now = que.front();
            que.pop();
            bian[fail[now]].push_back(now);
            //cerr<<fail[now]<<' '<<now<<'\n';
            cnt[now] += cnt[fail[now]];
            for(int i = 0;i < 26;i++){
                if(to[now][i]){
                    que.push(to[now][i]);
                    fail[to[now][i]] = to[fail[now]][i];
                }else{
                    to[now][i] = to[fail[now]][i];
                }
            }
        }
    }
}acam;
vector<int> Tvl[N];
vector<pair<int,int>> que[N];
int ans[N];
vector<int> bian1[N];
int S[N],sp;
void bvt(const vector<int> &points){
    sp = 0;
    S[++sp] = 1;
    bian1[1].clear();
    for(int i = points.front() == 1;i < points.size();i++){
        int lc = lca(S[sp],points[i]);
        if(lc != S[sp]){
            while(dfn[S[sp - 1]] > dfn[lc]){
                bian1[S[sp - 1]].push_back(S[sp]);
                sp--;
            }
            if(S[sp - 1] != lc){
                bian1[lc].clear();
                bian1[lc].push_back(S[sp]);
                S[sp] = lc;
            }else{
                bian1[lc].push_back(S[sp]);
                sp--;
            }
        }
        bian1[points[i]].clear();
        S[++sp] = points[i];
    }
    while(sp > 1){
        bian1[S[sp - 1]].push_back(S[sp]);
        sp--;
    }
}
int ansb = 0;
bool imp[N];
bool exist[N];
int cnt1[N];
void dfs2(int x,int fa){
    exist[x] = imp[x];
    for(int v: bian[x]){
        dfs2(v,x);
        exist[x] |= exist[v];
    }
}
void dfs2_5(int x,int fa){
    cnt1[x] = c1[x]*exist[x] + cnt1[fa];
    for(int v: bian[x]){
        dfs2_5(v,x);
    }
}
void dfs3(int x,int fa){
    ansb += cnt1[x] - cnt1[fa];
    for(int v : bian1[x]){
        dfs3(v,x);
    }
}
bool m1[N];
bool m2[N];
int sta[N];
void dfs4(int x,int fa){
    sta[x] = 0;
    if(m1[x]){
        sta[x] |= 1;
    }
    if(m2[x]){
        sta[x] |= 2;
    }
    for(int v: bian1[x])
    {   
        dfs4(v,x);
        sta[x] |= sta[v];
    }
    if(sta[x] == 3){
        ansb += acam.cnt[x] - acam.cnt[fa];
    }
}
bool ed;
int main(){
    cerr<<(&ed - &bg)/1048576.0<<'\n';
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,q;
    cin>>n>>m>>q;
    acam.init();
    int len = 0;
    for(int i = 1;i<=n;i++){
        cin>>s[i];
        acam.insert(s[i]);
    }
    acam.build();
    dfs(acam.rot,0);
    pre_lca();
    for(int i = 1;i <= m;i++){
        cin>>t[i];
        len += t[i].size();
        int cur = acam.rot;
        for(char c : t[i]){
            cur = acam.to[cur][c - 'a'];
            Tvl[i].push_back(cur);
        }
        sort(Tvl[i].begin(),Tvl[i].end(),[](int x,int y){
            return dfn[x] < dfn[y];
        });
        Tvl[i].erase(unique(Tvl[i].begin(),Tvl[i].end()),Tvl[i].end());
    }
    int lmt = sqrt(len);
    for(int i = 1;i <= q;i++){
        int x,y;
        cin>>x>>y;
        if(t[x].size() < t[y].size()){
            swap(x,y);
        }
        que[x].push_back(make_pair(y,i));
    }
    for(int i = 1;i <= m;i++){
        if(t[i].size() >= lmt){
            for(int v : Tvl[i]){
                imp[v] = 1;
            }
            dfs2(acam.rot,0);
            dfs2_5(acam.rot,0);
            map<int,int> mp;
            for(pair<int,int> qu : que[i]){
                int y,idx;
                tie(y,idx) = qu;
                if(mp.find(y) != mp.end()){
                    ans[idx] = mp[y];
                    continue;
                }
                bvt(Tvl[y]);
                ansb = 0;
                dfs3(1,0);
                mp[y] = ansb;
                ans[idx] = ansb;
            }
            for(int v: Tvl[i]){
                imp[v] = 0;
            }
        }else{
            for(int v: Tvl[i]){
                m1[v] = 1;
            }
            map<int,int> mp;
            for(pair<int,int> qu : que[i]){
                int y,idx;
                tie(y,idx) = qu;
                if(mp.find(y) != mp.end()){
                    ans[idx] = mp[y];
                    continue;
                }
                for(int v: Tvl[y]){
                    m2[v] = 1;
                }
                vector<int> mg(Tvl[i].size() + Tvl[y].size());
                merge(Tvl[i].begin(),Tvl[i].end(),Tvl[y].begin(),Tvl[y].end(),mg.begin(),[](int x,int y){
                    return dfn[x] < dfn[y];
                });
                mg.erase(unique(mg.begin(),mg.end()),mg.end());
                bvt(mg);
                ansb = 0;
                dfs4(1,0);
                for(int v:  Tvl[y]){
                    m2[v] = 0;
                }
                ans[idx] = ansb;
                mp[y] = ans[idx];
            }
            for(int v: Tvl[i]){
                m1[v] = 0;
            }
        }
    }
    for(int i = 1;i <= q;i++){
        cout<<ans[i]<<'\n';
    }
}